package com.hb.unic.core.async.threadpool;

import java.util.concurrent.ThreadPoolExecutor;

import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 默认 - 线程池操作类
 *
 * @since v1.0，2023/8/27 12:59，create by Mr.Huang.
 */
@Configuration
@ConditionalOnExpression("${config.threadpool.defaultTaskExecutor:true}")
public class DefaultThreadPoolTaskOperation extends BaseThreadPoolOperation {

    @Bean
    public ThreadPoolExecutor defaultTaskExecutor() {
        return createExecutor(20, 40, 60, 1000, "defaultTaskExecutor-", new ThreadPoolExecutor.AbortPolicy());
    }

}
